<?php
    $query = 'select * from tranno';
    $dbh = new PDO('odbc:ESSYSTEM', '', '');
    $stmt = $dbh->prepare("$query");
    $stmt->execute();
    while ($row = $stmt->fetch()) {
        print_r($row);
    }
    unset($dbh);
    unset($stmt);
    $dsn = "Driver={Microsoft Visual FoxPro Driver};SourceType=DBF;SourceDB=D:\\ESSYSTEM;Exclusive=NO;collate=Machine;NULL=NO;DELETED=NO;BACKGROUNDFETCH=NO;";
    $conn = odbc_connect($dsn, "", "");
    if ($conn) {
        ?>
        <table width="75%" border="1" cellspacing="1" cellpadding="1" bgcolor="#FFFFFF">
            <tr bgcolor="#CCFFFF">
                <td height="22"><b>Field1</b></td>
                <td height="22"><b>Field2</b></td>
                <td height="22"><b>Field3</b></td>
                <td height="22"><b>Field4</b></td>
            </tr>

            <?php
            $cur = odbc_exec($conn, "select * from tranno");
            while (odbc_fetch_row($cur)) {
//collect results
                $field1 = odbc_result($cur, 1);
                $field2 = odbc_result($cur, 2);
                $field3 = odbc_result($cur, 3);
                $field4 = odbc_result($cur, 4);
//format and display results
                print ("<tr>");
                print ("<td>$field1</td>");
                print ("<td>$field2</td>");
                print ("<td>$field3</td>");
                print ("<td>$field4</td>");
                print ("</tr>");
            }
            odbc_close($conn);
            ?>
        </table>
        <?php
    }
?>
